package com.tianqi.common.enums;

/**
 * 六爻起卦入参
 *
 * @author zhangzedi
 * @date 2023/8/19 12:08
 **/
public enum LiuYaoGuaEnum {

	LAOYIN(1, "阴阴阴", "0", true),
	LAOYANG(2, "阳阳阳", "1", true),
	SHAOYIN(3, "阳阳阴", "0", false),
	SHAOYANG(4, "阴阴阳", "1", false);

	/**
	 * 类型
	 */
	private Integer type;

	/**
	 * 名称
	 */
	private String name;

	/**
	 * 阴阳,1-阳，0-阴
	 */
	private String yang;

	/**
	 * 动爻,1-是，0-否
	 */
	private boolean change;

	LiuYaoGuaEnum(Integer type, String name, String yang, boolean change) {
		this.type = type;
		this.name = name;
		this.yang = yang;
		this.change = change;
	}

	public Integer getType() {
		return type;
	}

	public String getYang() {
		return yang;
	}

	public boolean getChange() {
		return change;
	}

	/**
	 * 根据类型查询枚举
	 *
	 * @param type
	 * @return
	 */
	public static LiuYaoGuaEnum findGuaByType(Integer type) {
		LiuYaoGuaEnum[] values = LiuYaoGuaEnum.values();
		for (LiuYaoGuaEnum liuYaoGuaEnum : values) {
			if (type.equals(liuYaoGuaEnum.getType())) {
				return liuYaoGuaEnum;
			}
		}
		return null;
	}
}
